home *** CD-ROM | disk | FTP | other *** search
/ Interactive Media Design Review 1999 / Interactive Media Design Review 1999.iso / pc / Demos / Herois / Codigo.Cst / 00132_Midias- Subtitulos utilities.ls < prev    next >
Encoding:
Text File  |  1999-03-19  |  3.9 KB  |  124 lines

  1. on listaMidiasSubTextos primLin, moveIndicador
  2.   --  Posicao dos sprites no score
  3.   set sprTxt = 71
  4.   set sprSub = 65
  5.   set sprInd = 84
  6.   
  7.   -- gLinhasMidia contera o numero total de linhas dos
  8.   -- subtextos
  9.   global gLinhasMidia, gMidiaLinha
  10.   global gMidiaSelecionada
  11.   
  12.   put primLin into gMidiaLinha
  13.   put 0 into gLinhasMidia
  14.   put 0 into subTitulo
  15.   put 0 into textoUsado
  16.   put - primLin into linha
  17.   put [5, 16] into subtitGrandes
  18.   
  19.   -- Decide onde pegar texto/subtitulos, de acordo
  20.   -- com midia
  21.   case gMidiaSelecionada of
  22.     2: 
  23.       set memTexto = the number of member "tv0"
  24.       set memSubTit = the number of member "SubTitulosTv"
  25.       put [16, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,┬¼
  26.        13, 14, 15, 17, 0] into ordem
  27.     4: 
  28.       set memTexto = the number of member "cinema0"
  29.       set memSubTit = the number of member "SubTitulosCi"
  30.       put [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,┬¼
  31.        13, 14, 15, 16, 17, 0] into ordem
  32.     8: 
  33.       set memTexto = the number of member "hq0"
  34.       set memSubTit = the number of member "SubTitulosHq"
  35.       put [16, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,┬¼
  36.        13, 14, 15, 17, 0] into ordem
  37.     16: 
  38.       set memTexto = the number of member "outras0"
  39.       set memSubTit = the number of member "SubTitulosHq"
  40.       put [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,┬¼
  41.        13, 14, 15, 16, 17, 0] into ordem
  42.   end case
  43.   
  44.   repeat while subTitulo <= 17
  45.     set idx = getAt(ordem,subTitulo+1)
  46.     -- Calcula tamanho do texto
  47.     if the type of ┬¼
  48.            member (memTexto + idx) = #field then
  49.       put the lineCount of ┬¼
  50.            member (memTexto + idx) into numLin
  51.       if numLin = 1 then
  52.         if the text of ┬¼
  53.            member (memTexto + idx) = "x" then
  54.           put 0 into numLin
  55.         end if
  56.       end if
  57.     else
  58.       set numLin = 0
  59.     end if
  60.     if numLin = 1 and getPos(subtitGrandes, idx) > 0 then
  61.       set numLin = 2
  62.     end if
  63.     
  64.     put gLinhasMidia + numLin into gLinhasMidia
  65.     
  66.     if numLin > 0 and linha + numLin > 0 and linha < 5 then
  67.       -- Ajusta posicao e tamanho do texto
  68.       set the puppet of sprite (sprTxt + textoUsado) to true
  69.       set the loc of sprite (sprTxt + textoUsado) to ┬¼
  70.         point(411,linha*16 + 16)
  71.       set the member of sprite (sprTxt + textoUsado) to┬¼
  72.         member (memTexto + idx)
  73.       sendSprite(sprTxt+textoUsado,#setMidia, gMidiaSelecionada, idx)
  74.       -- Controla subtitulos
  75.       if linha >= 0 then
  76.         puppetSprite (sprSub + textoUsado),true
  77.         set the member of sprite (sprSub + textoUsado) to┬¼
  78.               (memSubTit + idx)
  79.         set the locV of sprite (sprSub + textoUsado) to 26 + 16 * linha
  80.         set the locH of sprite (sprSub + textoUsado) to 362
  81.       else
  82.         -- Subtitulo aparece fora da tela
  83.         set the locV of sprite (sprSub + textoUsado) to 960
  84.         puppetSprite (sprSub + textoUsado),true
  85.       end if
  86.       set textoUsado = textoUsado + 1      
  87.     end if
  88.     -- Proximo subTitulo, se ainda houver espaco
  89.     put subTitulo + 1 into subTitulo
  90.     set linha = linha + numLin
  91.   end repeat
  92.   
  93.   -- Apaga as linhas que porventura sobraram
  94.   repeat while textoUsado < 6
  95.     set the locV of sprite (sprSub + textoUsado) to 960
  96.     set the locV of sprite (sprTxt + textoUsado) to 960
  97.     put textoUsado+1 into textoUsado
  98.   end repeat
  99.   
  100.   if moveIndicador then
  101.     if (gLinhasMidia <= 5) then
  102.       set the visibility of sprite sprInd to false
  103.     else
  104.       set the visibility of sprite sprInd to true
  105.       midiaIndicador gMidiaLinha * 10000 / (gLinhasMidia - 5)
  106.     end if
  107.   end if
  108. end
  109.  
  110. on midiaIndicador pos
  111.   put (80 - 32) * pos / 10000 + 32 into y
  112.   set the locV of sprite 84 to y
  113. end
  114.  
  115. on midiaScroll n
  116.   global gLinhasMidia, gMidiaLinha
  117.   if gMidiaLinha + n > gLinhasMidia - 5 then
  118.     put gLinhasMidia - 5 - gMidiaLinha into n
  119.   end if
  120.   if gMidiaLinha + n < 0 then
  121.     put - gMidiaLinha into n
  122.   end if
  123.   if n <> 0 then listaMidiasSubTextos gMidiaLinha + n, true
  124. end